package com.du.dupload;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;


public class FilesAutoAdd extends Thread {
	private List<String> progress;
    public void run() {
    	progress = new ArrayList<String>();
        while(true){
        	File startingDirectory = new File(AppConfig.getInstance().getInDir());
        	FileListing listing = new FileListing();
        	try {
				List<File> files = listing.getFileListing(startingDirectory);
				for(File f: files){
					if(!progress.contains(f.getAbsolutePath())){
						progress.add(f.getAbsolutePath());
						ArrayList<String> al = new ArrayList<String>();
						al.add(f.getAbsolutePath());
						TasksManager.getInstance().addTaskConvert(al);
					}
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
        	try {
				Thread.sleep(10000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
        }
    }



}


